<div id="map_canvas">
	
</div>

<script type="text/javascript">
	var map = new GMap2($('map_canvas'))
	/* TO-DO: Set a global settings object to handle this */
	var centerArea = new GLatLng(<%= global_conf.center_lat %>, <%= global_conf.center_lng %>);
	map.setCenter(centerArea, <%= global_conf.zoom %>);
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	map.enableScrollWheelZoom();


	<% access_nodes.each do |access_node| %>
		<% if !access_node.lat.nil? && !access_node.lng.nil? %>
			var point = new GLatLng(<%= access_node.lat %>, <%= access_node.lng %>);						
			
			var users = <%= access_node.online_users.count %>
			var active = true;
			var alert = false;
						
			<%= render :partial => 'access_nodes/info_string', :locals => { :node => access_node } %>
			
			var last_seen = <%= (Time.now.to_i - access_node.last_seen.to_i ).to_s %>
			
	    if (last_seen > 50000)
            {
                active = true;
                alert = true;				
            }
            if (last_seen > 500000)
            {
                active = false;
            }
            
            var marker = createMarker(point, active, alert, users, info_string);
            map.addOverlay(marker);
			
			<% unless routes.length == 0 %>
				<%= render :partial => 'access_nodes/routes', :locals => { :routes => routes }%>
			<% end %>
												
		<% end %>
	<% end %>
	
	
</script>
